Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test cases for EnumerableGuardianMap. #6

Merged
merged 7 commits into from
Jun 22, 2024
Merged

Conversation

wshino
Copy link
Contributor

@wshino wshino commented Jun 21, 2024

No description provided.


function test_Set_RevertWhen_MaxNumberOfGuardiansReached() public {
bool result;
// TODO: Can it be acceptable to number 33?
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding current implementation, it allows to store 33 guardians. Is that expected behavior?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes good catch, expected behaviour should be 32. Could you change to assertion in the library to ensure that the max number is 32?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JohnGuilding Fixed.

Copy link
Collaborator

@JohnGuilding JohnGuilding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for getting these done. Left some comments.

Before merging into main will need to merge the latest changes as there are some merge conflicts.

}

function test_Keys_ReturnsEmptyArrayOfKeys() public view {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool, can you remove this test case then?

addresses[0] = vm.addr(1);
addresses[1] = vm.addr(2);
addresses[2] = vm.addr(3);
guardiansStorage[accountAddress].removeAll(addresses);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an assert to check that the values are no longer in storage?

) {
addresses[i] = vm.addr(i + 1);
}
guardiansStorage[accountAddress].removeAll(addresses);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, can you add an assert to check that the values are no longer in storage?

guardiansStorage[accountAddress].set({
key: guardian1,
value: GuardianStorage(GuardianStatus.REQUESTED, guardianWeights[1])
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add an assert here

assertEq(recoveryRequest.executeAfter, 0);
assertEq(recoveryRequest.executeBefore, 0);
assertEq(recoveryRequest.currentWeight, 1);
assertEq(recoveryRequest.calldataHashString, "");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you merge the latest changes in, this has been changed to bytes32 from a string

@wshino wshino marked this pull request as ready for review June 22, 2024 10:41
Copy link
Collaborator

@JohnGuilding JohnGuilding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JohnGuilding JohnGuilding merged commit 9d5b06a into main Jun 22, 2024
2 of 3 checks passed
@JohnGuilding JohnGuilding deleted the feat/add-testcases branch June 22, 2024 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants